﻿@model App.Models.Sys.SysRoleModel
@using App.Common;
@using App.Models.Sys;
@using App.Admin;
@{
    ViewBag.Title = "创建";
    Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml";
    List<permModel> perm = (List<permModel>)ViewBag.Perm;
    if (perm == null)
    {
        perm = new List<permModel>();
    }
}

<script type="text/javascript">
    $(function () {
        $("#btnSave").click(function () {
            if ($("form").valid()) {
                $.ajax({
                    url: "@Url.Action("Create")",
                    type: "Post",
                    data: $("form").serialize(),
                    dataType: "json",
                    success: function (data) {
                        if (data.type == 1) {
                            window.parent.frameReturnByMes(data.message);
                            window.parent.frameReturnByReload(true);
                            window.parent.frameReturnByClose()
                        }
                        else {
                            window.parent.frameReturnByMes(data.message);
                        }
                    }
                });
            }
            return false;
        });
        $("#btnReturn").click(function () {
            window.parent.frameReturnByClose();
        });
    });
</script>
<div class="mvctool bgb">
    @Html.ToolButton("btnSave", "icon-save", "保存", perm, "Save", true)
    @Html.ToolButton("btnReturn", "icon-return", "返回", false)
</div>
@using (Html.BeginForm())
{
    @Html.HiddenFor(model => model.Id)
    <input id="CreateTime" type="hidden" name="CreateTime" value="2000-1-1" />
    <table class="fromEditTable setTextWidth300">
        <tbody>
            <tr>
                <td style="width: 100px; text-align: right;">
                    @Html.LabelFor(model => model.Name)：
                </td>
                <td style="width: 310px">
                    @Html.EditorFor(model => model.Name)
                </td>
                <td>@Html.ValidationMessageFor(model => model.Name)</td>
            </tr>
            <tr>
                <td style="width: 100px; text-align: right;">
                    @Html.LabelFor(model => model.Description)：
                </td>
                <td style="width: 310px">
                    @Html.TextAreaFor(mode => mode.Description, new
                    {
                        @style = "height: 200px"

                    })
                </td>
                <td>@Html.ValidationMessageFor(model => model.Description)</td>
            </tr>
        </tbody>
    </table>
}
